package com.flong.gui;

import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import com.flong.gui.TFMathTest2;

/**
 * @Author:liangjilong
 * @Date:2015年11月19日-上午10:17:13
 * @Email:jilonglinag@sina.com
 * @Version:1.0
 * @Description:
 */
@SuppressWarnings("all")
public  class MyListener2 implements ActionListener
{
	//private TFMathTest2 tfmt;
	
	private TextField num1, num2 , sum;
	
	public MyListener2(TFMathTest2 tfmt) {
		//this.tfmt = tfmt;
		/*
		this.num1 = tfmt.num1;
		this.num2 = tfmt.num2;
		this.sum = tfmt.sum;
		*/
		this(tfmt.num1, tfmt.num2, tfmt.sum);
	}
	
	public MyListener2(TextField num1, TextField num2, TextField sum) {
		this.num1 = num1;
		this.num2 = num2;
		this.sum = sum;
	}
	
	public void actionPerformed(ActionEvent e)
	{
		String s1 = num1.getText();
		String s2 = num2.getText();
		int i1 = Integer.parseInt(s1);
		int i2 = Integer.parseInt(s2);
		sum.setText(String.valueOf(i1 + i2));
	}
}